#!/usr/bin/node

const log=console.log;
//占256个字节
let buf1=new Buffer(256);
buf1[0]=0;

log(`buf1 length:${buf1.length}\n`)
log(buf1);

for(let i=0;i<256;i++){
  buf1[i]=i;
  
}
log(buf1);

let buf2=buf1.slice(250,256);
log('buf2:',buf2);

buf2.fill(0);
log('buf2:',buf2);

log('buf2:',buf2.toJSON());

let arr=['a',0xdf,0,255,10];
let buf3=new Buffer(arr);
log('buf3:',buf3);

let str='hello world';
let buf4=new Buffer(str);
log('buf4:',buf4);

buf4.copy(buf3,0,0,buf4.length);
log('buf3:',buf3);

